package com.xuedakun.xasdk.net.okhttp.download;

import java.util.LinkedList;

import okhttp3.OkHttpClient;

/**
 * Created by xuedakun on 2017/6/6 16:40
 * 下载管理
 *
 * @version : v1.0
 * @project : xasdk
 * @Email : dakun611@Gmail.com
 */

public class DownloadManager {

    private static final String LOG_TAG = "DownloadManager";
    
    private static DownloadManager instance;

    private final OkHttpClient downloadClient;

    /**
     * 下载队列
     */
    private static LinkedList<DownloadTask> downloadQueue = new LinkedList<>();

    private DownloadManager() {
        downloadClient = initDownloadClient();
    }

    public static DownloadManager getInstance() {
        synchronized (DownloadManager.class) {
            if (instance == null) {
                instance = new DownloadManager();
            }
            return instance;
        }
    }

    /**
     * 初始化下载所需的okhttpClient
     * @return
     */
    private OkHttpClient initDownloadClient() {
        OkHttpClient okHttpClient = new OkHttpClient();
        return okHttpClient;
    }
}
